﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace RestaurantApp.Web.Infrastructure.Poco
{
    public class PagingPage
    {
        public static string Paging(int CurrentPage, int PerPage, int TotalRecords, string BaseUrl)
        {
            //if (CurrentPage >0)
            //{
            //    CurrentPage = CurrentPage - 1;
            //}
            Pagination pagination = new Pagination();
            pagination.BaseUrl = BaseUrl;
            pagination.TotalRows = TotalRecords;
            pagination.CurPage = CurrentPage == 0 ? 1 : Convert.ToInt16(CurrentPage + 1);
            pagination.PerPage = PerPage;
            pagination.NumLinks = 2;
            pagination.FullTagOpen = "<div class='pagination'> <ul> <li>";
            pagination.FullTagClose = "</li>  </ul></div>";
            pagination.FirstLink = "صفحه اول";
            pagination.LastLink = "صفحه آخر";
            return pagination.GetPageLinks();
        }
    }
}